﻿#include "FITKAbaStepDynamicExplicit.h"


Interface::FITKAbaStepDynamicExplicit::FITKAbaStepDynamicExplicit()
{
    m_nlgeom = true;
    m_restartNumberInterval = 1;
}

bool Interface::FITKAbaStepDynamicExplicit::copy(FITKAbstractDataObject* obj)
{
    bool ok = FITKAbaAbstractStep::copy(obj);
    if (!ok)
        return false;
    FITKAbaStepDynamicExplicit* step = dynamic_cast<FITKAbaStepDynamicExplicit*>(obj);
    if (step == nullptr)
        return false;
    this->m_improvedDtMethod = step->m_improvedDtMethod;
    this->m_includeAdiabaticHeatingEffects = step->m_includeAdiabaticHeatingEffects;
    this->m_incrementSizeSelection = step->m_incrementSizeSelection;
    this->m_incrementType = step->m_incrementType;
    this->m_linearBulkViscosityParameter = step->m_linearBulkViscosityParameter;
    this->m_massScaleingDefinitions = step->m_massScaleingDefinitions;
    this->m_massScalingType = step->m_massScalingType;
    this->m_maxTimeIncrement = step->m_maxTimeIncrement;
    this->m_maxTimeIncrementValue = step->m_maxTimeIncrementValue;
    this->m_quadraticBulkViscosityParameter = step->m_quadraticBulkViscosityParameter;
    this->m_stableIncrementEstimator = step->m_stableIncrementEstimator;
    this->m_timeScalingFactor = step->m_timeScalingFactor;
    this->m_userDefinedTimeIncrement = step->m_userDefinedTimeIncrement;
    return true;
}

Interface::FITKAbaAbstractStep::FITKAbaStepType Interface::FITKAbaStepDynamicExplicit::getStepType() const
{
    return Interface::FITKAbaAbstractStep::FITKAbaStepType::DynamicExplicit;
}

bool Interface::FITKAbaStepDynamicExplicit::getIncludeAdiabaticHeatingEffects() const
{
    return m_includeAdiabaticHeatingEffects;
}

void Interface::FITKAbaStepDynamicExplicit::setIncludeAdiabaticHeatingEffects(bool stat)
{
    m_includeAdiabaticHeatingEffects = stat;
}

Interface::FITKAbaAbstractStep::TimeIncrementType Interface::FITKAbaStepDynamicExplicit::getIncrementType() const
{
    return m_incrementType;
}

void Interface::FITKAbaStepDynamicExplicit::setIncrementType(TimeIncrementType type)
{
    m_incrementType = type;
}

Interface::FITKAbaAbstractStep::StableIncrementEstimator Interface::FITKAbaStepDynamicExplicit::getStableIncrementEstimator() const
{
    return m_stableIncrementEstimator;
}

void Interface::FITKAbaStepDynamicExplicit::setStableIncrementEstimator(StableIncrementEstimator type)
{
    m_stableIncrementEstimator = type;
}

bool Interface::FITKAbaStepDynamicExplicit::getImproveDtMethod() const
{
    return m_improvedDtMethod;
}

void Interface::FITKAbaStepDynamicExplicit::setImproveDtMethod(bool stat)
{
    m_improvedDtMethod = stat;
}

Interface::FITKAbaAbstractStep::MaxTimeIncrement Interface::FITKAbaStepDynamicExplicit::getMaxTimeIncrement() const
{
    return m_maxTimeIncrement;
}

void Interface::FITKAbaStepDynamicExplicit::setMaxTimeIncrement(MaxTimeIncrement type)
{
    m_maxTimeIncrement = type;
}

double Interface::FITKAbaStepDynamicExplicit::getMaxTimeIncrementValue() const
{
    return m_maxTimeIncrementValue;
}

void Interface::FITKAbaStepDynamicExplicit::setMaxTimeIncrementValue(double value)
{
    m_maxTimeIncrementValue = value;
}

double Interface::FITKAbaStepDynamicExplicit::getTimeScalingFactor() const
{
    return m_timeScalingFactor;
}

void Interface::FITKAbaStepDynamicExplicit::setTimeScalingFactor(double factor)
{
    m_timeScalingFactor = factor;
}

Interface::FITKAbaAbstractStep::IncrementSizeSelection Interface::FITKAbaStepDynamicExplicit::getIncrementSizeSelection() const
{
    return m_incrementSizeSelection;
}

void Interface::FITKAbaStepDynamicExplicit::setIncrementSizeSelection(IncrementSizeSelection type)
{
    m_incrementSizeSelection = type;
}

double Interface::FITKAbaStepDynamicExplicit::getUserDefinedTimeIncrement() const
{
    return m_userDefinedTimeIncrement;
}

void Interface::FITKAbaStepDynamicExplicit::setUserDefinedTimeIncrement(double inc)
{
    m_userDefinedTimeIncrement = inc;
}

Interface::FITKAbaAbstractStep::MassScaling Interface::FITKAbaStepDynamicExplicit::getMassScaling() const
{
    return m_massScalingType;
}

Interface::FITKAbaMassScalingDefinition *Interface::FITKAbaStepDynamicExplicit::createMassScalingDefinition(int index)
{
    if (index = -1)
    {
        m_massScaleingDefinitions.push_back(FITKAbaMassScalingDefinition());
        return &m_massScaleingDefinitions.last();
    }
    else
    {
        if (index >= 0 && index <= m_massScaleingDefinitions.size())
        {
            m_massScaleingDefinitions.insert(index, FITKAbaMassScalingDefinition());
            return &m_massScaleingDefinitions[index];
        }
    }
    return nullptr;
}

void Interface::FITKAbaStepDynamicExplicit::insertMassScalingDefinition(int index, const FITKAbaMassScalingDefinition& define)
{
    if (index >= 0 && index <= m_massScaleingDefinitions.size())
        m_massScaleingDefinitions.insert(index, define);
}

void Interface::FITKAbaStepDynamicExplicit::removeMassScalingDefinition(int index)
{
    if (index >= 0 && index < m_massScaleingDefinitions.size())
        m_massScaleingDefinitions.removeAt(index);
}

int Interface::FITKAbaStepDynamicExplicit::getNumberOfMassScalingDefinition() const
{
    return m_massScaleingDefinitions.size();
}

Interface::FITKAbaMassScalingDefinition *Interface::FITKAbaStepDynamicExplicit::getMassScalingDefinition(int index)
{
    if (index >= 0 && index < m_massScaleingDefinitions.size())
        return &m_massScaleingDefinitions[index];
    return nullptr;
}

void Interface::FITKAbaStepDynamicExplicit::setMassScaling(MassScaling type)
{
    m_massScalingType = type;
}

double Interface::FITKAbaStepDynamicExplicit::getLinearBulkViscosityParameter() const
{
    return m_linearBulkViscosityParameter;
}

void Interface::FITKAbaStepDynamicExplicit::setLinearBulkViscosityParameter(double value)
{
    m_linearBulkViscosityParameter = value;
}

double Interface::FITKAbaStepDynamicExplicit::getQudraticBulkViscosityParameter() const
{
    return m_quadraticBulkViscosityParameter;
}

void Interface::FITKAbaStepDynamicExplicit::setQudraticBulkViscosityParameter(double value)
{
    m_quadraticBulkViscosityParameter = value;
}
